Skip to content

Development: Show gender-inclusive wording feedback in the AI sidebar - #2630

Open
ge94zec wants to merge 8 commits into
mainfrom
feat/2378-improve-genderdecoder-accuracy-using-ai
Open

Development: Show gender-inclusive wording feedback in the AI sidebar#2630
ge94zec wants to merge 8 commits into
mainfrom
feat/2378-improve-genderdecoder-accuracy-using-ai

Conversation

@ge94zec

@ge94zec ge94zec commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the client coding and design guidelines.
  • I added multiple integration tests (Vitest) related to the features (with a high test coverage), while following the client test guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Displaying the result in the existing AI assistant sidebar and linking it to editor highlights makes the feedback easier to understand and act on without introducing a separate workflow.

Description

This PR integrates the Gender Decoder results directly into the AI assistant sidebar and the job description editor.
The sidebar now shows the current wording balance as exclusive, neutral, or inclusive, together with the number of detected non-inclusive terms. Selecting the Gender Decoder filter highlights the affected wording directly in the editor independently from the existing compliance highlights.

Steps for Testing

Prerequisites:

  1. Log in to DocApply
  2. Nav to Create position
  3. Test if GenderDecoder in sidebar is in sync with genderDecoder in editor

Review Progress

Code Review

  • Code Review 1

Manual Tests

  • Test 1

Screenshots

Test Coverage

Client

Class/File Line Coverage Lines Expects Ratio
job-creation-form.component.ts 0.00% 1258 96 7.6
editor.component.ts 70.73% 412 31 7.5
ai-assistant-card.component.ts 90.76% 136 11 8.1
gender-bias-analysis.ts 4.54% 75 17 22.7
gender-bias-analysis.utils.ts 100.00% 8 2 25.0

Last updated: 2026-08-19 13:18:47 UTC

@ge94zec ge94zec linked an issue Aug 4, 2026 that may be closed by this pull request
@github-actions github-actions Bot added client Pull requests that update TypeScript code. (Added Automatically!) tests labels Aug 4, 2026
@codacy-production

codacy-production Bot commented Aug 4, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 medium · 3 minor

Alerts:
⚠ 5 issues (≤ 0 issues of at least minor severity)

Results:
5 new issues

Category Results
ErrorProne 2 medium
CodeStyle 3 minor

View in Codacy

🟢 Metrics 23 complexity

Metric Results
Complexity 23

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions

Copy link
Copy Markdown
Contributor

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Aug 11, 2026
ge94zec and others added 2 commits August 17, 2026 13:55
- display gender decoder results and balance indicator in the AI sidebar
- reuse status pills with counts, loading state, and active styling
- highlight non-inclusive wording with wavy underlines in the editor
- allow filtering between gender and compliance highlights
- deduplicate and sanitize non-inclusive words in a shared utility
- add English and German translations for the gender pill
- remove unrelated background process and analysis pause changes
- simplify tests
@ge94zec ge94zec changed the title feat: add genderDecoder UI in sidebar Feat: Add genderDecoder UI in sidebar Aug 17, 2026
@ge94zec ge94zec changed the title Feat: Add genderDecoder UI in sidebar Development: Add genderDecoder UI in sidebar Aug 17, 2026
@ge94zec
ge94zec marked this pull request as ready for review August 17, 2026 21:10
@ge94zec
ge94zec requested a review from az108 as a code owner August 17, 2026 21:10

@az108 az108 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature, and the sidebar integration reads well — the shared getUniqueNonInclusiveWords util with its own spec is the right call, and renaming pendingHighlights to pendingComplianceHighlights makes the two highlight paths readable. All three changed spec files pass locally (50 tests).

One blocking issue and one behavioural bug below.

1. Gender-bias highlight markup leaks into the form control (blocking)

stripHighlightMarkup() is the guard that keeps visual-only highlight markup out of the form value, but it only knows about HighlightBlot.className (compliance-highlight). The new gender-bias-highlight spans pass straight through it — see the inline comment on editor.component.ts. Consequences are the persisted description picking up highlight spans, and a self-sustaining loop of analyze-html requests.

Worth noting this makes #2379 measurably worse rather than being a separate concern.

2. Gender pill spinner is bound to the compliance analysis state

See the inline comment on ai-assistant-card.component.html. The pill shows a green "all clear" check while the gender analysis is still in flight on page load, and can never show a spinner again after the first result.

Things I checked and found fine

Flagging these so they don't come up again in a later review round:

  • px vs rem (h-[2px], [text-decoration-thickness:1.5px]) — no rule on units in client-styling.mdx, and px arbitrary values are used throughout the client (h-[1px], border-[0.5px], text-[10px]). Correct choice for hairlines.
  • Absolute positioning of the balance scale — the right tool for an overlay marker on a track. Track and pointer centers land 0.2px apart, so nothing is actually misaligned. Only a cosmetic nit below.
  • Asserting Tailwind classes in the pointer test — established practice here (star-rating.component.spec.ts:66-77 does the same), and the class string is the only observable output of a 5-branch computed. expect(x).not.toBeNull() is literally the documented pattern in client-tests.mdx:219.
  • Static class plus [class] binding on the pointer — Angular merges both; same pattern already in status-pill.component.html:11.
  • decoration-text-tertiary — valid, --color-text-tertiary is inside the @theme block in _tokens.scss:111.
  • Gender-decoder logic living in the editor atom — it was already there before this PR, and atoms in this project routinely inject domain services. Not a finding for this PR. I opened #2634 for the follow-up refactor (single highlight API plus a central blot registry), which would make bug 1 structurally impossible to reintroduce.

Nits

  • The gender branch of applyPendingHighlights() has no test coverage. Given bug 1 lives exactly there, one test asserting that the editor HTML written back to the form control contains no highlight spans would be well placed.
  • PR title: genderDecoder is a code identifier rather than plain English — something like `Development`: Show gender-inclusive wording feedback in the AI sidebar reads from user impact. The red Validate PR Title check is stale, by the way: the current title matches the regex and just needs a re-run.

@ge94zec ge94zec changed the title Development: Add genderDecoder UI in sidebar Development`: Show gender-inclusive wording feedback in the AI sidebar Aug 17, 2026
@ge94zec ge94zec changed the title Development`: Show gender-inclusive wording feedback in the AI sidebar Development: Show gender-inclusive wording feedback in the AI sidebar Aug 17, 2026
@github-actions github-actions Bot removed the stale label Aug 19, 2026
- strip compliance and gender highlight markup from editor values
- track gender analysis loading independently per editor field
- bind the gender pill to its dedicated loading state
- center the gender balance indicator without fixed offsets
- cover editor event handling and pill loading states
@ge94zec
ge94zec requested a review from az108 August 19, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Pull requests that update TypeScript code. (Added Automatically!) ready for review tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve genderDecoder accuracy using AI

2 participants